package com.example.demo2.service;

import com.example.demo2.bean.CommentBean;
import com.example.demo2.dao.CommentBeanDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentBeanService {
    @Autowired
    CommentBeanDao dao;
    public List<CommentBean> list() {
        List<CommentBean> all = dao.findAll();
        return all;
    }

    public void deleteById(Integer comment_id) {
        dao.deleteById(comment_id);
    }

    public CommentBean addone(CommentBean commentBean) {
        CommentBean save = dao.save(commentBean);
        return save;
    }

    public CommentBean update(CommentBean commentBean) {
        CommentBean save = dao.save(commentBean);
        return save;
    }
}
